package com.剑指offer.第一章;

/**
 *
 */
public class 只出现一次的数字 {

    public static int resolve(int nums[]) {
        int[] ints = new int[32];
        for (int num : nums) {
            for (int i = 0; i < 32; i++) {
                ints[i] += (num >> 31 - i) & 1;
            }
        }
        int result = 0;
        for (int i = 0; i < 32; i++) {
            System.out.println(result);
            result = (result << 1) + ints[i] % 3;
        }
        return result;
    }

    public static void main(String[] args) {
//        int rseult = (2 << 1) + 3 % 3;
        int[] nums = new int[]{
                0, 1, 0, 1, 0, 1, 100
        };
        System.out.println(resolve(nums));
    }

}
